package cn.leida.demo;

import cn.leida.demo.util.FxUtil;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.BorderPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class JavaFxVue extends Application {

    @Override
    public void start(Stage primaryStage) {
        // 创建 WebView
        WebView webView = new WebView();
        WebEngine webEngine = webView.getEngine();


        // 加载网页，可以是本地文件或在线网页
        // webEngine.load("https://www.baidu.com");
        webEngine.load("http://localhost:8349/index.html");
        // 创建布局并将 WebView 添加到场景中
        BorderPane root = new BorderPane();
        root.setCenter(webView);

        int width = 1300;
        int height = 750;
        Scene scene = new Scene(root, width, height);
        primaryStage.getIcons().add(FxUtil.getImage("/static/logo.png"));// icon

        primaryStage.setMinWidth(width);
        primaryStage.setMinHeight(height);
        primaryStage.setTitle("雷达运营(单机版)");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
